package com.woniu.punishcomplaintnotice.mapper;

import com.woniu.common.entity.Adopt;
import com.woniu.common.entity.AdoptApply;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AdoptMapper {

    @Insert("insert into adopt values(null,#{sex},#{age},#{type},#{weight},#{height},#{longs},#{photo},#{status})")
   void insertDog(Adopt adopt);

    //修改领养状态
    @Update("update adopt set status = 2 where id = #{id}")
    boolean updateStatus(Integer id);

    //查询领养信息
    @Select("select * from adopt where status = 1")
    List<Adopt> findAllAdopt();

    //领养申请
    @Insert("insert into adopt_apply values(default,#{uname},#{icd_image},#{person_image},#{icd},#{sex},#{ethnic},#{domicile_address},#{tel},#{now_address},#{detailed_address},#{supporting_material},#{adopt_id},1,null)")
    boolean addAdoptApply(AdoptApply adoptApply);

}
